/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.sonrisas.tools.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author DIEGOALV
 */
@Entity
@Table(name = "plan")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Plan.findAll", query = "SELECT p FROM Plan p"),
    @NamedQuery(name = "Plan.findByIdPlan", query = "SELECT p FROM Plan p WHERE p.idPlan = :idPlan"),
    @NamedQuery(name = "Plan.findByFecha", query = "SELECT p FROM Plan p WHERE p.fecha = :fecha"),
    @NamedQuery(name = "Plan.findByTotal", query = "SELECT p FROM Plan p WHERE p.total = :total"),
    @NamedQuery(name = "Plan.findByActivoPlan", query = "SELECT p FROM Plan p WHERE p.activoPlan = :activoPlan")})
public class Plan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPlan")
    private Integer idPlan;
    @Column(name = "fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "total")
    private BigDecimal total;
    @Basic(optional = false)
    @Column(name = "activoPlan")
    private boolean activoPlan;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPlan")
    private List<Pago> pagoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "plan")
    private List<Plantratamiento> plantratamientoList;

    public Plan() {
    }

    public Plan(Integer idPlan) {
        this.idPlan = idPlan;
    }

    public Plan(Integer idPlan, boolean activoPlan) {
        this.idPlan = idPlan;
        this.activoPlan = activoPlan;
    }

    public Integer getIdPlan() {
        return idPlan;
    }

    public void setIdPlan(Integer idPlan) {
        this.idPlan = idPlan;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    public boolean getActivoPlan() {
        return activoPlan;
    }

    public void setActivoPlan(boolean activoPlan) {
        this.activoPlan = activoPlan;
    }

    @XmlTransient
    public List<Pago> getPagoList() {
        return pagoList;
    }

    public void setPagoList(List<Pago> pagoList) {
        this.pagoList = pagoList;
    }

    @XmlTransient
    public List<Plantratamiento> getPlantratamientoList() {
        return plantratamientoList;
    }

    public void setPlantratamientoList(List<Plantratamiento> plantratamientoList) {
        this.plantratamientoList = plantratamientoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPlan != null ? idPlan.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Plan)) {
            return false;
        }
        Plan other = (Plan) object;
        if ((this.idPlan == null && other.idPlan != null) || (this.idPlan != null && !this.idPlan.equals(other.idPlan))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Plan[ idPlan=" + idPlan + " ]";
    }
    
}
